<!-- <template>
  <Card>
    <div class="flexCSB">
      <div>
        <Input
          v-model="name"
          style="width: 300px"
          placeholder="请输入会员昵称"
          suffix="ios-search"
          @on-blur="changeNickName"
        ></Input>
        <Input
          v-model="phone"
          style="width: 300px"
          placeholder="请输入会员手机号"
          suffix="ios-search"
          @on-blur="changePhone"
        ></Input>
        <Radio-group
          v-model="status"
          @on-change="changeStatus"
          type="button"
          size="large"
        >
          <Radio label="1">全部</Radio>
          <Radio label="2">已失效</Radio>
        </Radio-group>
      </div>
    </div>
    <Table
      class="table"
      :loading="loading1"
      highlight-row
      :columns="columns"
      :data="tableData"
    ></Table>
    <Page
      show-total
      class="page"
      :total="total"
      :current.sync="pageNum"
      :page-size="pageSize"
      show-elevator
      @on-change="changePage"
    />
  </Card>
</template> -->

<script>
export default {
  data () {
    return {
      columns: [
        {
          title: '头像',
          key: 'headImg',
          align: 'center',
          width: 150,
          render: (h, params) => {
            return h('img', {
              style: {
                width: '80px',
                display: 'block',
                marginLeft: '50px',

                marginTop: '10px',
                marginBottom: '10px'
              },
              attrs: {
                src: this.prefix + params.row.headImg
              }
            })
          }
        },
        { title: '昵称', key: 'nickName', align: 'center' },
        { title: '手机号', key: 'phone', align: 'center' },
        {
          title: '生效时间',
          key: 'effectiveTime',
          align: 'center'
        },
        { title: '失效时间', key: 'failureTime', align: 'center' },
        {
          title: '享受折扣',
          key: 'discount',
          align: 'center'
        }
      ],
      tableData: [],
      pageNum: 1,
      pageSize: 10,
      total: 0,
      name: '',
      phone: '',
      status: '1',
      loading1: false
    }
  },
  created () {
    this.getData()
  },
  mounted () {},
  methods: {
    // 获取数据
    getData () {
      this.loading1 = true
      this.$http(
        '/ztmuseum/stage/member/getMemberList',
        {
          current: this.pageNum,
          size: this.pageSize,
          name: this.name,
          phone: this.phone,
          status: this.status
        },
        'post',
        (res) => {
          console.log(res)
          if (res.data.code == 1000) {
            this.tableData = res.data.data.records
            this.tableData.map((item) => {
              item.discount = item.discount + '折'
            })
            this.total = res.data.data.total
          } else {
            this.$Message.error(res.data.msg)
          }
          this.loading1 = false
        }
      )
    },
    // 分页，改变页码
    changePage (data) {
      console.log(data)
      this.pageNum = data
      this.getData()
    },
    changeNickName () {
      this.pageNum = 1
      this.getData()
    },
    changePhone () {
      this.pageNum = 1
      this.getData()
    },
    changeStatus () {
      this.pageNum = 1
      this.getData()
    }
  }
}
</script>

<style scoped>
</style>
